﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.Platform.Contract;
using MaxLeaf.Platform.BLLImplementation;
using CommonsLib.Utility;
using MaxLeaf.Platform.DataContract;
using CommonsLib.Settings;
using MaxLeaf.Platform.Functions;

namespace MaxLeaf.Platform.BLLProxy
{

    /// <summary>
    /// 公司 相关操作
    /// </summary>
    public class CompanyProcessorProxy : BaseBLLProxy, ICompanyProcess
    {

        ICompanyProcess _bll;
        private  ICompanyProcess BLL
        {
            get
            {                
                return _bll;
            }
        }
        public CompanyProcessorProxy():base()
        {
            switch ( Access_Mode )
            {

                case MaxLeaf.Platform.Commons.Const.ACCESS_Direct:
                    {
                        _bll = new CompanyProcessor();
                        break;
                    }

                case MaxLeaf.Platform.Commons.Const.ACCESS_IIS:
                    {
                        _bll = new CompanyProcessorWCFClient(this.WCF_Configs);
                        break;
                    }


                default:
                    {
                        throw new MaxLeaf.Platform.Commons.MaxLeafException(MaxLeaf.Platform.Commons.Const.EXCEPTION_MESSAGE_INVALID_ACCESSMODE_CONFIG);

                    }
            }
        }
        

        /// <summary>
        /// 初始化公司数据
        /// </summary>
        /// <param name="intFromCompanyID">来源公司</param>
        /// <param name="intToCompanyID">目标公司</param>
        /// <returns>是否成功</returns>
        public bool InitData(int intFromCompanyID, int intToCompanyID)
        {
            return BLL.InitData(intFromCompanyID, intToCompanyID);
        }

        /// <summary>
        /// 获取用户编号
        /// </summary>
        /// <param name="blnDirectCity">是否直辖市</param>
        /// <param name="intProvID">省</param>
        /// <param name="intCityID">市</param>
        /// <param name="intRegionID">区</param>
        /// <returns>用户编号</returns>
        public string GetUserSN(bool blnDirectCity, int intProvID, int intCityID, int intRegionID)
        {
            return BLL.GetUserSN(blnDirectCity, intProvID, intCityID, intRegionID);
        }

        /// <summary>
        /// 添加子公司
        /// </summary>
        /// <param name="company">mCompanyDataModel</param>
        /// <param name="company_info">mCompany_InfoDataModel</param>
        /// <param name="lstSCP">SCPCategoryDataModel 集合</param>
        /// <param name="user">mUser_MainDataModel</param>
        /// <param name="user_info">mUser_InfoDataModel</param>
        /// <returns>公司key</returns>
        public int AddCompany(mCompanyDataModel company, mCompany_InfoDataModel company_info, List<SCPCategoryDataModel> lstSCP, mUser_MainDataModel user, mUser_InfoDataModel user_info)
        {
            return BLL.AddCompany(  company,   company_info,   lstSCP,   user,   user_info);
        }

        /// <summary>
        /// 添加人员
        /// </summary>
        /// <param name="User">mUser_MainDataModel</param>
        /// <param name="User_info">mUser_InfoDataModel</param>
        /// <returns>人员key</returns>
        public int AddUser(mUser_MainDataModel User, mUser_InfoDataModel User_info)
        {
            return BLL.AddUser(User, User_info);
        }
    }
}
